package com.hjq.controller;

import com.hjq.pojo.ClazzOption;
import com.hjq.pojo.JobOption;
import com.hjq.pojo.Result;
import com.hjq.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 信息统计
 */
@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    ReportService reportService;

    /**
     * 获取职位统计信息
     * @return 职位信息
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("获取职位信息");
        JobOption jobOption =reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    /**
     * 获取员工性别信息
     * return 员工性别信息
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("获取员工性别信息");
        List<Map<String, Object>> empGenderData = reportService.getEmpGenderData();
        return Result.success(empGenderData);
    }

    /**
     * 获取学生学历信息
     * return 学生学历信息
     */
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        log.info("获取学生学历信息");
        List<Map<String, Object>> studentDegreeData = reportService.studentDegreeData();
        return Result.success(studentDegreeData);
    }

    /**
     * 获取班级统计信息
     * @return 信息
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info("获取班级统计信息");
        ClazzOption clazzOption = reportService.getStudentCountData();
        return Result.success(clazzOption);
    }
}
